var http = require('http');

var server = http.createServer();

server.on('request',function (req,res) {
   //1.通过 req.url 获取当前路径
    var url = req.url

             //通过res.write()是浏览器渲染获取的内容
    res.writeHead(200,{
        'Content-Type':'text/html'
    });
    
    //2.根据不同的请求路径，处理不同的的响应
    if (url==='/'){
        res.end('<h2>index page</h2>')
    }else if (url==='/login'){
        res.end('<h2>longin page</h2>')
    }else if (url==='/register'){
        res.end('<h2>regiser page</h2>>')
    }else {
        res.end('<h2>404 Not Found</h2>')
    }
});

server.listen(3000,function () {
    console.log('running...................')
});













